package com.mk.eventbus;

import android.os.Looper;
import android.os.Message;

/**
 * Created by mk on 2017/9/13.
 */

public class MainUiThreadHandler extends android.os.Handler{
    public MainUiThreadHandler(Looper looper) {
        super(looper);
    }

    @Override
    public void handleMessage(Message msg) {
        EventBus.getInstance().invoke(subscription,event,subscription.subscroptionMethod.method);
    }
    private Subscription subscription;
    private Object event;
    public void post(Subscription subscription,Object event){
        this.subscription=subscription;
        this.event=event;
        sendEmptyMessage(0);//唤醒HandleMessage
    }
}
